Skip adding wikitext test pages in PrefixSearchTest if NS_MAIN is not wikitext
authoraude <aude.wiki@gmail.com>
Fri, 14 Aug 2015 09:32:08 +0000 (11:32 +0200)
committeraude <aude.wiki@gmail.com>
Fri, 14 Aug 2015 09:32:08 +0000 (11:32 +0200)
these tests get skipped and so should adding these pages, since it
leads to a fatal error and inability to run tests on such a wiki.

Bug: T97416
Change-Id: Icc4e325ecbc5ed069d12bbad686812f6a45b47e7

tests/phpunit/includes/PrefixSearchTest.php

index d63541b..afd10e9 100644 (file)
@@ -6,6 +6,11 @@
 class PrefixSearchTest extends MediaWikiLangTestCase {
 
        public function addDBData() {
+               if ( !$this->isWikitextNS( NS_MAIN ) ) {
+                       // tests are skipped if NS_MAIN is not wikitext
+                       return;
+               }
+
                $this->insertPage( 'Sandbox' );
                $this->insertPage( 'Bar' );
                $this->insertPage( 'Example' );